<template>
  <el-collapse-item title="日期格式" name="format">
    <el-form label-width="90px">
      <el-form-item label="显示设置">
        <el-checkbox v-model="curComponent.dateShow" label="日期" :true-label="0" :false-label="1"></el-checkbox>
        <el-checkbox v-model="curComponent.weekShow" label="星期" :true-label="0" :false-label="1"></el-checkbox>
        <el-checkbox v-model="curComponent.timeShow" label="时间" :true-label="0" :false-label="1"></el-checkbox>
        <el-checkbox v-model="curComponent.lunarShow" label="农历" :true-label="0" :false-label="1"></el-checkbox>
      </el-form-item>
      <el-form-item label="日期" class="form-item-flex">
        <el-color-picker v-model="curComponent.dateColor" class="flex-item"></el-color-picker>
        <el-select v-model="curComponent.dateFormat">
          <el-option
            v-for="item in dateFormateOptions"
            :key="item.value"
            :value="item.value"
            :label="item.label"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="星期" class="form-item-flex">
        <el-color-picker v-model="curComponent.weekColor" class="flex-item"></el-color-picker>
        <el-select v-model="curComponent.weekFormat">
          <el-option
            v-for="item in weekFormatOptions"
            :key="item.value"
            :value="item.value"
            :label="item.label"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="星期位于时间">
        <el-radio-group v-model="curComponent.weekTimeSwap">
          <el-radio :label="1">前</el-radio>
          <el-radio :label="0">后</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="时间" class="form-item-flex">
        <el-color-picker v-model="curComponent.timeColor" class="flex-item"></el-color-picker>
        <el-select v-model="curComponent.timeFormat">
          <el-option
            v-for="item in timeFormatOptions"
            :key="item.value"
            :value="item.value"
            :label="item.label"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="农历">
        <el-color-picker v-model="curComponent.lunarColor"></el-color-picker>
      </el-form-item>
      <el-form-item label="布局">
        <el-radio-group v-model="curComponent.layout">
          <el-radio :label="1">单行</el-radio>
          <el-radio :label="0">多行</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="时区">
        <el-select v-model="curComponent.timeZoneValue">
          <el-option
            v-for="item in timeZoneOptions"
            :key="item.value"
            :value="item.value"
            :label="item.label"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="自定义文字" class="form-item-flex">
        <el-input v-model="curComponent.text" class="flex-item"></el-input>
        <el-color-picker v-model="curComponent.textColor"></el-color-picker>
      </el-form-item>
      <el-form-item label="背景色">
        <el-color-picker v-model="curComponent.backColor"></el-color-picker>
      </el-form-item>
    </el-form>
  </el-collapse-item>
</template>

<script>
import { dateFormateOptions, weekFormatOptions, timeFormatOptions, timeZoneOptions } from '@/utils/attr'

export default {
  name: 'FormatAttr',
  data() {
    this.dateFormateOptions = dateFormateOptions
    this.weekFormatOptions = weekFormatOptions
    this.timeFormatOptions = timeFormatOptions
    this.timeZoneOptions = timeZoneOptions
    return {}
  },
  computed: {
    curComponent() {
      return this.$store.state.curComponent
    },
  },
}
</script>
